package com.rabbitmq.producer;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@SpringBootApplication
public class RabbitmqProducerApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext applicationContext = SpringApplication.run(RabbitmqProducerApplication.class, args);

        RabbitSender rabbitSender = applicationContext.getBean(RabbitSender.class);

        Map<String, Object> properties = new HashMap<>();
        for (int i = 0; i < 100; i++) {
            properties.put("number", System.currentTimeMillis());
            properties.put("send_time", System.currentTimeMillis());
            rabbitSender.send("Hello RabbitMQ For Spring Boot!" + i, properties);
        }
    }

}
